package org.jimmy.tang.tools.mp3;

import java.io.File;
import java.io.IOException;
import java.io.RandomAccessFile;

/**
 * @author jimmy
 * 
 */
public class Mp3 {

	private String songName; // 歌曲名4-33
	private String oldName;
	private String artist; // 歌手名34-63
	private String album; // 专辑名61-93
	private String year; // 年94-97
	private String comment; // 备注98-125
	private byte r1, r2, r3; // 三个保留位126，127，128
	private boolean valid; // 是否合法
	private RandomAccessFile ran;

	/**
	 * @param file
	 *            (我们创建当前类的对象的时候初始化我们传过来的music对象)
	 * @throws IOException
	 */
	public Mp3(File file) throws IOException {
		super();
		ran = new RandomAccessFile(file, "r");
		oldName = file.getName();
	}

	/**
	 * 
	 * @throws IOException
	 */
	public void close() throws IOException {
		ran.close();
		songName = null;
		artist = null;
		album = null;
		year = null;
		comment = null;
	}

	public String getOldName() {
		return oldName;
	}

	public void setOldName(String oldName) {
		this.oldName = oldName;
	}

	/**
	 * @return the ran
	 */
	public RandomAccessFile getRan() {
		return ran;
	}

	/**
	 * @param ran
	 *            the ran to set
	 */
	public void setRan(RandomAccessFile ran) {
		this.ran = ran;
	}

	public String getArtist() {
		return artist;
	}

	public void setArtist(String authorName) {
		artist = authorName;
	}

	public String getComment() {
		return comment;
	}

	public void setComment(String comment) {
		this.comment = comment;
	}

	public byte getR1() {
		return r1;
	}

	public void setR1(byte r1) {
		this.r1 = r1;
	}

	public byte getR2() {
		return r2;
	}

	public void setR2(byte r2) {
		this.r2 = r2;
	}

	public byte getR3() {
		return r3;
	}

	public void setR3(byte r3) {
		this.r3 = r3;
	}

	public String getSongName() {
		return songName;
	}

	public void setSongName(String songName) {

		this.songName = songName;
	}

	public String getAlbum() {
		return album;
	}

	public void setAlbum(String specialName) {
		album = specialName;
	}

	public String getYear() {
		return year;
	}

	public void setYear(String year) {
		this.year = year;
	}

	/**
	 * @return the valid
	 */
	public boolean isValid() {
		return valid;
	}

	/**
	 * @param valid
	 *            the valid to set
	 */
	public void setValid(boolean valid) {
		this.valid = valid;
	}

}
